<?php
/**
 * Created by PhpStorm.
 * User: Aliaksei Lazerka
 * Date: 10/12/14
 * Time: 5:28 PM
 */

namespace exception;

if (!defined('NYMPH_ROOT')) {
  define('NYMPH_ROOT', dirname("../../../" . __FILE__));
  require(NYMPH_ROOT . '/local/loader/kernel/classes/URLClassLoader.php');
}


abstract class IException extends \Exception
{
  /**
   * Path to file< where exception was thrown
   * @var string
   */
  private $caller;

  /**
   * @return string
   */
  public function getCaller()
  {
    return $this->caller;
  }

  /**
   * @param string $caller
   */
  public function setCaller($caller)
  {
    $this->caller = $caller;
  }

  /**
   * @param string $message
   */
  public function __construct($message)
  {
    $this->message = $message;
    $this->caller = $_SERVER['PHP_SELF'];
  }

  /**
   * @param string $string to change
   * @param string $needle part to replace
   * @param string $subject replacement
   * @return string
   */
  protected static function replaceMessage($needle, $subject, $string)
  {
    return str_replace($needle, $subject, $string);
  }

} 